﻿using System;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using Loki.UI.Win.Messages;

namespace Loki.UI.Win
{
    public partial class ErrorMessageBox : XtraForm
    {
        public ErrorMessageBox()
        {
            InitializeComponent();
            BTN_Copy.Text = UIMessages.CLIPBOARD_COPY;
        }

        private void BTN_Copy_Click(object P_Sender, EventArgs e)
        {
            Clipboard.SetText(RTX_Message.Text);
        }

        public static DialogResult Show(Exception P_Exception)
        {
            ErrorMessageBox L_Dialog = new ErrorMessageBox();
            try
            {
                L_Dialog.Text = UIMessages.LABEL_ERROR;
                L_Dialog.LBL_Message.Text = P_Exception.Message;
                L_Dialog.RTX_Message.Text = P_Exception.ToString();
                L_Dialog.RTX_Message.Properties.ReadOnly = true;
                DialogResult L_Result = L_Dialog.ShowDialog();

                return L_Result;
            }
            finally
            {
                L_Dialog.Dispose();
            }
        }
    }
}
